// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import ElementUI from 'element-ui';
import Element from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Vue from 'vue'
import App from './App'
import axios from 'axios'
import VueAxios from 'vue-axios'
import router from './router'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'


Vue.prototype.axios = axios;
Vue.prototype.HOME = '/api';
axios.defaults.withCredentials = false;

Vue.use(mavonEditor);
Vue.use(Element, { size: 'small', zIndex: 3000 });
Vue.use(ElementUI);
Vue.use(router);
Vue.use(VueAxios,axios);

Vue.config.productionTip = false

Vue.prototype.getCookie = function (objName) {  //获取指定名称的cookie的值
  let arrStr = document.cookie.split(";");
  for (let i = 0; i < arrStr.length; i++) {
    let temp = arrStr[i].split("=");
    if (temp[0] == objName) return unescape(temp[1])

  }
};
Vue.prototype.setCookie = function (name , value) {//两个参数，一个是cookie的名子，一个是值
  let Days = 30; //此 cookie 将被保存 30 天
  let exp = new Date();    //new Date("December 31, 9998");
  exp.setTime(exp.getTime() + Days*24*60*60*1000);
  document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
};

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
});

